/*****************************************************************************/
/**
 *  @file   main.cpp
 *  @author Naohisa Sakamoto
 */
/*----------------------------------------------------------------------------
 *
 *  Copyright (c) Visualization Laboratory, Kyoto University.
 *  All rights reserved.
 *  See http://www.viz.media.kyoto-u.ac.jp/kvs/copyright/ for details.
 *
 *  $Id$
 */
/*****************************************************************************/
#include <iostream>
#include <string>
#include <util/SPHFileList.h>
#include <util/ImportStaggeredSPHFile.h>
#include <kvs/Math>

int main( int argc, char** argv )
{
    std::string dirname( argv[1] );
    kvsbloodvis::util::SPHFileList sph_list( dirname );
    sph_list.print( std::cout );

    kvs::Real64 min =  10000.0;
    kvs::Real64 max = -10000.0;

    for ( size_t i = 0; i < sph_list.size(); i++ )
    {
        sph_list.sph(i).print( std::cout << std::endl );

        kvs::StructuredVolumeObject volume = kvsbloodvis::util::ImportStaggeredSPHFile( sph_list.sph(i) );
        volume.print( std::cout );

        min = kvs::Math::Min( min, volume.minValue() );
        max = kvs::Math::Max( max, volume.maxValue() );
    }

    std::cout << std::endl;
    std::cout << "Min. value : " << min << std::endl;
    std::cout << "Max. value : " << max << std::endl;

    return 0;
}
